# -*- coding: utf-8 -*-
# @Time : 2025/3/6 15:38
# @Author : debbyszhang
# @File : conftest.py
# @desc :


def pytest_terminal_summary(terminalreporter, exitstatus, config):
    stats = terminalreporter.stats

    # 提取通过的测试用例数
    passed = len(stats.get('passed', []))
    failed = len(stats.get('failed', []))
    error = len(stats.get('error', []))
    skipped = len(stats.get('skipped', []))

    # 计算收集到的测试用例总数
    total = terminalreporter._numcollected

    summary = f"""
    测试结果：
    测试用例总数：{total}
    测试通过数：{passed}
    测试失败数：{failed}
    测试错误数：{error}
    测试跳过数：{skipped}
    """
    print(summary)
